<template>
  <div class="app-container">
    <el-table :data="data" style="width: 100%" row-key="id" border>
      <el-table-column
        v-for="(col,index) in columns"
        :key="index"
        :prop="col.field"
        :label="col.title"
        :width="col.width"
      />
      <el-table-column label="操作">
        <template slot-scope="scope">
          <el-button
            size="mini"
            @click="handleEdit(scope.$index, scope.row)"
          >编辑</el-button>
          <el-button
            size="mini"
            type="danger"
            @click="handleDelete(scope.$index, scope.row)"
          >删除</el-button>
        </template>
      </el-table-column>
    </el-table>
    <el-pagination
      background,
      page-size="10"
      layout="prev, pager, next"
      :total="1000"
    />
  </div>
</template>
<script>
export default {
  props: [
    'data', 'columns'
  ],
  data() {
    return {

    }
  },
  methods: {
    handleEdit(index, row) {
      this.$emit('editHandle', row)
    },
    handleDelete(index, row) {
      this.$emit('deleteHandle', row)
    }

  }
}
</script>
